home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / Memory.p < prev    next >
Encoding:
Text File  |  1991-04-03  |  3.9 KB  |  171 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Sunday, January 6, 1991 at 10:47 PM}
  5. {    Memory.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc.    1985-1990}
  9. {        All rights reserved}
  10. {}
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18. unit Memory;
  19. interface
  20.     uses
  21.         Types;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.     const
  36.         maxSize = $800000;  {Max data block size is 8 megabytes}
  37.         defaultPhysicalEntryCount = 8;
  38.         defaultPhysicalEntryCountMinusOne = defaultPhysicalEntryCount - 1;
  39.  
  40. { values returned from the GetPageState function }
  41.         kPageInMemory = 0;
  42.         kPageOnDisk = 1;
  43.         kNotPaged = 2;
  44.  
  45.     type
  46.         MemoryBlock = record
  47.                 address: Ptr;
  48.                 count: LONGINT;
  49.             end;
  50.  
  51.         LogicalToPhysicalTable = record
  52.                 logical: MemoryBlock;
  53.                 physical: array[0..defaultPhysicalEntryCountMinusOne] of MemoryBlock;
  54.             end;
  55.  
  56.  
  57.         PageState = INTEGER;
  58.         StatusRegisterContents = INTEGER;
  59.  
  60.     procedure HLockHi (h: Handle);
  61.     inline
  62.         $205F, $A064, $A029;
  63.     function StripAddress (theAddress: univ Ptr): Ptr;
  64.  
  65.     function Translate24To32 (addr24: univ Ptr): Ptr;
  66.     inline
  67.         $201F, $A091, $2E80;
  68.     function TempNewHandle (logicalSize: Size; var resultCode: OSErr): Handle;
  69.     inline
  70.         $3F3C, $001D, $A88F;
  71.     function TempMaxMem (var grow: Size): Size;
  72.     inline
  73.         $3F3C, $0015, $A88F;
  74.     function TempFreeMem: LONGINT;
  75.     inline
  76.         $3F3C, $0018, $A88F;
  77.  
  78. {  Temporary Memory routines renamed, but obsolete, in System 7.0 and later.  }
  79.     procedure TempHLock (h: Handle; var resultCode: OSErr);
  80.     inline
  81.         $3F3C, $001E, $A88F;
  82.     procedure TempHUnlock (h: Handle; var resultCode: OSErr);
  83.     inline
  84.         $3F3C, $001F, $A88F;
  85.     procedure TempDisposeHandle (h: Handle; var resultCode: OSErr);
  86.     inline
  87.         $3F3C, $0020, $A88F;
  88.     function TempTopMem: Ptr;
  89.     inline
  90.         $3F3C, $0016, $A88F;
  91.  
  92. {  Temporary Memory routines as they were known before System 7.0.  }
  93.     function MFMaxMem (var grow: Size): Size;
  94.     inline
  95.         $3F3C, $0015, $A88F;
  96.     function MFFreeMem: LONGINT;
  97.     inline
  98.         $3F3C, $0018, $A88F;
  99.     function MFTempNewHandle (logicalSize: Size; var resultCode: OSErr): Handle;
  100.     inline
  101.         $3F3C, $001D, $A88F;
  102.     procedure MFTempHLock (h: Handle; var resultCode: OSErr);
  103.     inline
  104.         $3F3C, $001E, $A88F;
  105.     procedure MFTempHUnlock (h: Handle; var resultCode: OSErr);
  106.     inline
  107.         $3F3C, $001F, $A88F;
  108.     procedure MFTempDisposHandle (h: Handle; var resultCode: OSErr);
  109.     inline
  110.         $3F3C, $0020, $A88F;
  111.     function MFTopMem: Ptr;
  112.     inline
  113.         $3F3C, $0016, $A88F;
  114.  
  115.     function CompactMemSys (cbNeeded: Size): Size;
  116.  
  117.     procedure PurgeMemSys (cbNeeded: Size);
  118.     inline
  119.         $201F, $A44D;
  120.  
  121.     function FreeMemSys: LONGINT;
  122.     inline
  123.         $A41C, $2E80;
  124.     procedure ResrvMem (cbNeeded: Size);
  125.     inline
  126.         $201F, $A040;
  127.     procedure ReserveMem (cbNeeded: Size);
  128.     inline
  129.         $201F, $A040;
  130.     procedure ReserveMemSys (cbNeeded: Size);
  131.     inline
  132.         $201F, $A440;
  133.  
  134.     function MaxMemSys (var grow: Size): Size;
  135.  
  136.     function HoldMemory (address: univ Ptr; count: LONGINT): OSErr;
  137.     function UnholdMemory (address: univ Ptr; count: LONGINT): OSErr;
  138.     function LockMemory (address: univ Ptr; count: LONGINT): OSErr;
  139.     function LockMemoryContiguous (address: univ Ptr; count: LONGINT): OSErr;
  140.     function UnlockMemory (address: univ Ptr; count: LONGINT): OSErr;
  141.     function GetPhysical (var addresses: LogicalToPhysicalTable; var physicalEntryCount: LONGINT): OSErr;
  142.     function DeferUserFn (userFunction: ProcPtr; argument: univ Ptr): OSErr;
  143.     function DebuggerGetMax: LONGINT;
  144.     inline
  145.         $7000, $A08D, $2E80;
  146.     procedure DebuggerEnter;
  147.     inline
  148.         $7001, $A08D;
  149.     procedure DebuggerExit;
  150.     inline
  151.         $7002, $A08D;
  152.     procedure DebuggerPoll;
  153.     inline
  154.         $7003, $A08D;
  155.     function GetPageState (address: univ Ptr): PageState;
  156.     inline
  157.         $205F, $7004, $A08D, $3E80;
  158.     function PageFaultFatal: BOOLEAN;
  159.     inline
  160.         $7005, $A08D, $1E80;
  161.     function DebuggerLockMemory (address: univ Ptr; count: LONGINT): OSErr;
  162.     function DebuggerUnlockMemory (address: univ Ptr; count: LONGINT): OSErr;
  163.     function EnterSupervisorMode: StatusRegisterContents;
  164.     inline
  165.         $7008, $A08D, $3E80;
  166.  
  167.  
  168. implementation
  169. end.
  170.  
  171.